﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using IM.Manage.Models;

namespace IM.Manage.Controllers
{
    public class NewsCategoryController : Controller
    {
        //private IMManageContext db = new IMManageContext();

        //
        // GET: /NewsCategory/

        public ActionResult Index()
        {
            //return View(db.NewsCategory.ToList());
            return View();
        }

        //
        // GET: /NewsCategory/Details/5

        public ActionResult Details(int id = 0)
        {
            //NewsCategory newscategory = db.NewsCategory.Find(id);
            //if (newscategory == null)
            //{
            //    return HttpNotFound();
            //}
            //return View(newscategory);
            return View();
        }

        //
        // GET: /NewsCategory/Create

        public ActionResult Create()
        {
            return View();
        }

        //
        // POST: /NewsCategory/Create

        [HttpPost]
        public ActionResult Create(NewsCategory newscategory)
        {
            if (ModelState.IsValid)
            {
                //db.NewsCategory.Add(newscategory);
                //db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(newscategory);
        }

        //
        // GET: /NewsCategory/Edit/5

        public ActionResult Edit(int id = 0)
        {
            //NewsCategory newscategory = db.NewsCategory.Find(id);
            //if (newscategory == null)
            //{
            //    return HttpNotFound();
            //}
            //return View(newscategory);
            return View();
        }

        //
        // POST: /NewsCategory/Edit/5

        [HttpPost]
        public ActionResult Edit(NewsCategory newscategory)
        {
            if (ModelState.IsValid)
            {
                //db.Entry(newscategory).State = EntityState.Modified;
                //db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(newscategory);
        }

        //
        // GET: /NewsCategory/Delete/5

        public ActionResult Delete(int id = 0)
        {
            //NewsCategory newscategory = db.NewsCategory.Find(id);
            //if (newscategory == null)
            //{
            //    return HttpNotFound();
            //}
            //return View(newscategory);
            return View();
        }

        //
        // POST: /NewsCategory/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(int id)
        {
            //NewsCategory newscategory = db.NewsCategory.Find(id);
            //db.NewsCategory.Remove(newscategory);
            //db.SaveChanges();
            return RedirectToAction("Index");
        }

        protected override void Dispose(bool disposing)
        {
            //db.Dispose();
            base.Dispose(disposing);
        }
    }
}